package io.renren.modules.business.controller;

import java.util.Arrays;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.modules.business.entity.EPositionEntity;
import io.renren.modules.business.service.EPositionService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 职位表
 */
@RestController
@RequestMapping("/business/eposition")
public class EPositionController {

    @Autowired
    private EPositionService ePositionService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = ePositionService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{positionId}")
    public R info(@PathVariable("positionId") Long positionId){
		EPositionEntity ePosition = ePositionService.getById(positionId);

        return R.ok().put("ePosition", ePosition);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody EPositionEntity ePosition){
		ePositionService.save(ePosition);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody EPositionEntity ePosition){
		ePositionService.updateById(ePosition);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] positionIds){
		ePositionService.removeByIds(Arrays.asList(positionIds));

        return R.ok();
    }

}
